package com.itheima.health.resource.date;

import org.springframework.util.unit.DataUnit;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class CalendarDemo {

    public static void main(String[] args) {

        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH,-12);

        System.out.println(calendar.getTime());

        Date time = calendar.getTime();

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
        String format = simpleDateFormat.format(time);
        System.out.println(format);

      calendar.add(Calendar.MONTH,1);
        System.out.println(calendar.getTime());


        System.out.println(DateUtils.getThisWeekMonday());
        System.out.println(DateUtils.getSundayOfThisWeek());
        System.out.println(DateUtils.getFirstDay4CurrentMonth());
        System.out.println(DateUtils.getLastDayOfMonth(new Date()));
        System.out.println(DateUtils.getToday());


    }
}
